package io.renren.modules.task.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.task.model.MessageBo;
import io.renren.modules.task.service.MessageService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-11-21 17:25:31
 */
@RestController
@RequestMapping("generator/businessmessage")
public class MessageController {
    @Autowired
    private MessageService messageService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("generator:businessmessage:list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = messageService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("generator:businessmessage:info")
    public R info(@PathVariable("id") Long id) {
        //BusinessMessageEntity businessMessage = businessMessageService.getById(id);

        return R.ok().put("businessMessage", "businessMessage");
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:businessmessage:save")
    public R save(@RequestBody MessageBo businessMessage) {
        //businessMessageService.save(businessMessage);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:businessmessage:update")
    public R update(@RequestBody MessageBo businessMessage) {
        //businessMessageService.updateById(businessMessage);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:businessmessage:delete")
    public R delete(@RequestBody Long[] ids) {
        //businessMessageService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
